import os


def split_file(file_path, num_parts):
    # 获取文件大小（以字节为单位）
    file_size = os.path.getsize(file_path)

    # 计算每个部分的大小
    part_size = file_size // num_parts

    with open(file_path, 'rb') as f:
        for i in range(num_parts):
            part_data = f.read(part_size)
            part_file_name = f"easy_part_{i + 1}.mp4"
            with open(part_file_name, 'wb') as part_file:
                part_file.write(part_data)

    print(f"文件已成功分割成 {num_parts} 份")


# 将视频文件等比分割成 4 份
split_file("C:/Users/summit/Videos/Captures/2.mp4", 4)
